

/*****
*add by chengxaing 2011.6.9
*
*********/

#include <types.h>
#include <io.h>
#define __sw16(x) \
	((__u16)( \
		(((__u16)(x) & (__u16)0x00ffU) << 8) | \
		(((__u16)(x) & (__u16)0xff00U) >> 8) ))
#define __sw32(x) \
	((__u32)( \
		(((__u32)(x)) << 24) | \
		(((__u32)(x) & (__u32)0x0000ff00UL) <<  8) | \
		(((__u32)(x) & (__u32)0x00ff0000UL) >>  8) | \
		(((__u32)(x)) >> 24) ))




/*
 * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
 */
 int in_8(volatile u8 * addr)
{
	return (int)*addr;
}

 void out_8(volatile u8 * addr, int val)
{
	*addr = (u8) val;
}

 int in_le16(volatile u16 * addr)
{
	return __sw16(*addr);
}

 int in_be16(volatile u16 * addr)
{
	return (*addr & 0xFFFF);
}

 void out_le16(volatile u16 * addr, int val)
{
	*addr = __sw16(val);
}

 void out_be16(volatile u16 * addr, int val)
{
	*addr = (u16) val;
}

 unsigned in_le32(volatile u32 * addr)
{
	return __sw32(*addr);
}

 unsigned in_be32(volatile u32 * addr)
{
	return (*addr);
}

extern void out_le32(volatile unsigned *addr, int val)
{
	*addr = __sw32(val);
}

 void out_be32(volatile unsigned *addr, int val)
{
	*addr = val;
}

/*
 * Given a physical address and a length, return a virtual address
 * that can be used to access the memory range with the caching
 * properties specified by "flags".
 */
#define MAP_NOCACHE	(0)
#define MAP_WRCOMBINE	(0)
#define MAP_WRBACK	(0)
#define MAP_WRTHROUGH	(0)
#if 0
static void *map_physmem(phys_addr_t paddr, unsigned long len,
				unsigned long flags)
{
	return (void *)paddr;
}

/*
 * Take down a mapping set up by map_physmem().
 */
static void unmap_physmem(void *vaddr, unsigned long flags)
{

}

static phys_addr_t virt_to_phys(void * vaddr)
{
	return (phys_addr_t)(vaddr);
}
#endif
